package model;

import lombok.ToString;

/**
 * @author wujiazhan
 * @ClassName ModelParameter 模型参数
 * @description 简化代码，将系统需要的变量封装到模型参数类中
 * @date 2021-05-23 15:10
 */
@SuppressWarnings("all")
@ToString
public class ModelParameter {
    //小车质量
    public double M_car;
    //倒立摆杆重量
    public double M_stick;
    //摆杆的长度
    private double stick_length;
    //倒立摆杆长度的1/2
    public double l_stick;
    //作用在小车水平方向的力
    public double F;
    //小车位置
    public double x_car;
    //杠杆摆角
    public double theta;
    //小车位置一阶微分
    public double x_1;
    //摆角一阶微分
    public double theta_1;
    //采用时间
    public double samplingTime;
    //重力加速度
    public double G;
    //摆杆的转动惯量
    public double J_stick;
    //J+ml2
    public double J_ml2;
    //m2l2
    public double m2l2;
    //mlg
    public double mlg;


    public ModelParameter(double M_car, double M_stick, double stick_length, double theta, double samplingTime, double G){
        this.M_car = M_car;
        this.M_stick = M_stick;
        this.G = G;
        this.stick_length = stick_length;
        this.samplingTime = samplingTime;
        this.theta = theta;
        this.l_stick = stick_length / 2;
        this.J_stick =  M_car * Math.pow(l_stick,2) / 3;
        this.J_ml2 = J_stick + M_stick * Math.pow(l_stick,2);
        this.m2l2 = Math.pow(M_stick, 2) * Math.pow(l_stick,2);
        this.mlg = M_stick * this.l_stick * G;
    }

}
